<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>监视器的应用</title>
</head>
<body>
<div id="app">
    <div>
        question:<input v-model="question"/>
    </div>

    <div>
        answer:<input v-model="answer"/>
    </div>

</div>
</body>
<script src="../../../lib/vue.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            question: '',
            answer: '.'
        },
        watch: {
            question: function () {
                this.answer = "loading....";
                this.getAnswer();
            }
        }, methods: {
            getAnswer: function () {
                var _this = this;
                setTimeout(function () {
                    _this.answer = "here is an answer!";
                }, 2000)
            }
        }
    })


</script>
</html>